<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <a href="/home/" class="button">返回</a>
    <title>个人信息</title>
</head>
<body>
    <h2>个人信息</h2>
    {% if messages %}
        <ul class="messages">
            {% for message in messages %}
                <li {% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
            {% endfor %}
        </ul>
    {% endif %}
    {% if user %}
        <p><strong>用户名:</strong> {{ user.username }}</p>
        <p><strong>邮箱:</strong> {{ user.email }}</p>
        <p><strong>电话:</strong> {{ user.tel }}</p>
    {% else %}
        <p>用户信息未找到。</p>
    {% endif %}
    <form action="/personal/" method="post">
        {% csrf_token %}
        <button type="submit" name="action" value="2">注销</button>
        <button type="submit" name="action" value="3">修改</button>
        <button type="submit" name="action" value="4">查询所有信息</button>
        <div class="container mt-5">
            <h1>修改个人信息</h1>
            <form action="/personal/" method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="id_email" class="form-label">邮箱</label>

                    {{ form.email.errors }}
                    {{ form.email }}
                </div>
                <div class="mb-3">
                    <label for="id_pname" class="form-label">密码</label>
                    {{ form.password.errors }}
                    {{ form.password }}
                </div>
                <div class="mb-3">
                    <label for="id_tel" class="form-label">电话</label>
                    {{ form.tel.errors }}
                    {{ form.tel }}
                </div>
            </form>
        </div>
    </form>
</body>
</html>

